#ifndef CONVERTPROCESS_H
#define CONVERTPROCESS_H

#include<QProcess>
#include<QDebug>

class convertProcess : public QObject
{
    Q_OBJECT


signals:
    void progressUpdated(double);

public:
    explicit convertProcess(QObject* parent);
    void startProcess(QString const& file_Path,QString const& in_Fmt,QString const& out_Fmt,QString const& outputName);
    virtual ~convertProcess() override;
    void stopProcess();

private:
    long long convertToMilliSeconds(int hours,int minutes,int seconds,int milliseconds);

private slots:
    void onProcessStarted();
    void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);

    void onReadyReadStandardError();
private:
    QProcess* m_process = nullptr;
    QString ffmpeg_Path = "D:/ffmpeg-7.1-full_build-shared/bin/ffmpeg.exe";

    QString file_Name;
    QString output_Name;
    QString input_Fmt;
    QString output_Fmt;

    long long totalMilliSeconds = 0;

};

#endif // CONVERTPROCESS_H
